<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="a"></div>
<script>
    var allPeple = [{
        name: '小王',
        id: 14
    },{
        name: '大王',
        id: 41
    },{
        name: '老王',
        id: 61
    }]

    var myTeamArr = [{
        name: '小王',
        id: 14

    }]
    var PId = 14; //假如这个是要添加的人的ID
    function pFn(p){return p.id == PId ;}
    // myTeamArr.findIndex(pFn) == -1 ? myTeamArr.push(allPeple.find(pFn)) : alert('已存在该人员');
    var a = allPeple.find(element=>{
        if(element.id === PId){
            return element
        }
    })
    console.log(a)
</script>
</body>
</html>